Pritam Dalal and Thomas Mock
Workbench: develop in Python using VS Code, JupyterLab, and Jupyter Notebook (classic)
Connect: deploy a wide range of Python data products, including Jupyter Notebooks (reports, ETL jobs), Dash apps, FastAPIs, Quarto projects
Package Manager: serves up a full PyPI mirror and internally developed Python packages
Posit has a rich and storied history of developing open source software for the R ecosystem: RStudio IDE, tidyverse, Shiny.
In the last couple of years, Posit has begun significant development in the Python open source ecosystem with projects like Quarto, Vetiver, Shiny for Python.
All three Posit professional products (Workbench, Connect, Package Manager) have extensive support for Python data science.
We have extended our open-source mission to include Python with project like Vetiver, Shiny for Python, and Quarto.
Given our deep history with R, and our extensive support for Python, Posit Team is great for bilingual data science teams.
Posit Team is an excellent solution for Python only teams.
Warning!
This talk is not intended to be a self-contained workshop.
install quarto
install quarto VSCode extension
clone github repo: https://github.com/pritamdalal/posit_python_quarto
create a virtual environment and: pip install -r requirements.txt
Quarto is an open-source scientific and technical publishing system that builds on standard markdown with features essential for scientific communication.
Literate programming system in the tradition of Org-Mode, Weave.jl, R Markdown, iPyPublish, Jupyter Book, etc.
Open Source project sponsored by Posit, PBC (formerly known as RStudio, PBC)
Builds on Posit’s decade of experience developing R Markdown, a similar system that is R-specific
The number of languages and runtimes used for scientific discourse is broad
Quarto is a ground-up re-imagining of R Markdown that is fundamentally multi-language and multi-engine
Quarto gets inspiration from both R Markdown and Jupyter; it allows for development in a plain-text format (.qmd) or in Jupyter notebooks (.ipynb)
With Quarto, from a single source file, you can render a variety of output types.
---
title: "matplotlib demo"
format:
html:
code-fold: true
jupyter: python3
---
For a demonstration of a line plot on a polar
axis, see @fig-polar.```{python}
#| label: fig-polar
#| fig-cap: "A line plot on a polar axis"
import numpy as np
import matplotlib.pyplot as plt
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fig, ax = plt.subplots(
subplot_kw = {'projection': 'polar'}
)
ax.plot(theta, r)
ax.set_rticks([0.5, 1, 1.5, 2])
ax.grid(True)
plt.show()
```Our simple example, can be rendered to dozens of output formats with Quarto (via Pandoc):
| Feature | R Markdown | Quarto |
|---|---|---|
| Basic Formats | ||
| Beamer | ||
| PowerPoint | ||
| HTML Slides | ||
| Advanced Layout |
| Feature | R Markdown | Quarto |
|---|---|---|
| Cross References | ||
| Websites & Blogs | ||
| Books | ||
| Interactivity | Shiny Documents | Quarto Interactive Documents |
| Paged HTML | pagedown | Coming soon! |
| Journal Articles | rticles | Out and more coming! |
| Dashboards | flexdashboard | Coming soon! |
Quarto® is an open-source scientific and technical publishing system built on Pandoc.
Rendering (execute and write to disk):
Quarto executes Python with Jupyter kernels such as IPython.
{python} executable cells are present. You can set a specific kernel via the YAML:IPython executes Python code and transforms it to plain text, graphics, markdown, HTML, etc.
For interactive sessions, Quarto keeps the Jupyter Kernel resident as a daemon to mitigate startup times.
.qmd is a plain text fileCode
.ipynb as sourcePlain text workflow (.qmd uses Jupyter kernel to execute code chunks):
Notebook workflow (.ipynb executes code using Jupyter kernel, or can use computations stored in notebook):
.ipynb?You can keep using them! You get to choose whether to use the stored computation OR re-execute the document from top to bottom.
Quarto can help convert back and forth between plain text .qmd and .ipynb.
quarto convert --help
Usage: quarto convert <input>
Description:
Convert documents to alternate representations.
Convert notebook to markdown: quarto convert doc.ipynb
Convert markdown to notebook: quarto convert doc.qmd
Convert notebook to markdown, write to file: quarto convert doc.ipynb --output doc.qmdVSCode with the Quarto extension has rich auto-completion with .qmd files: